public class CargoBoat2 {
     int realContent;  //装载的重量
  
     int minContent;//最小装载梁

     public void setMinContent(int z) {
         minContent = z;
     }

   
            public void loading(int n) throws DangerException2 {
       realContent += n;
       if(realContent<minContent) {
          throw new DangerException2();
       }

       System.out.println("目前装载了"+realContent+"吨货物");
     }
}

